package lesson09



class Person(var name:String,var age:Int)

object Person {//单例对象

  def apply():Unit ={//void
    println("1");
  }
  def apply(name:String): Unit ={
    println("hello "+ name);
  }
  def apply(name:String,age:Int):Person={
    new Person(name,age) //最后一行代码就是我们的返回值
  }

  def main(args: Array[String]): Unit = {
    //
//    val p=Person()
//    val p1=Person("spark")

    // val xiaoma = new Person("xiaoma",90)
     val xiaoma: Person = Person("xiaoma",99)

    val ints = Array(1,2,3,4)



  }

}
